my_list = ['crazyit',20,'Python']
print(my_list)
my_tuple = ('crazyit',20,'Python')
print(my_tuple)
print(my_tuple[0])
print(my_tuple[-1])

a_tuple = ('crazyit',20,5.6,'fkit',-17)
print(a_tuple[1:3])
b_tuple = (1,2,3,4,5,6,7,8,9)
print(b_tuple[2:8:2])

print(a_tuple+b_tuple)
#元组和列表不能相加

print(a_tuple*3)

print(5.6 in a_tuple)
print(5.6 not in a_tuple)

print(max(b_tuple))

#序列封包和解包===========
vals = 10,20,30
print(vals)
print(vals[1])
print(type(vals))

a_tuple = tuple(range(1,10,2))
print(a_tuple)
a,b,c,d,e = a_tuple
print(a,b,c,d,e)
a_list = ['fkit','crazyit']
a_va11,a_val2 = a_list
print(a_va11,a_val2)

first,second,*rest = range(10)
print(first)
print(second)
print(rest)

*begin,last = range(10)
print(begin)
print(rest)

#创建列表或者元组==========================
a_tuple = ('crazyit',20,-1.2)
a_list = list(a_tuple)
print(a_list)

a_range = range(1,5)
print(a_range)

b_list = list(a_range)
print(b_list)
print(tuple(a_range))

c_list = list(range(4,20,3))
print(c_list)
print(tuple(range(4,20,3)))

#增加
a_list= ['crazyit',20,-2]
a_list.append('fkit')
print(a_list)
a_tuple = (3.4,5.6)
a_list.append(a_tuple)
print(a_list)
a_list.append(['a','b'])
print(a_list)

b_list = ['a',30]
b_list.extend((-2,3.1))
print(b_list)

b_list.extend(['crazyit',20,-2])
print(b_list)

b_list.extend(range(97,100))
print(b_list)

c_list = list(range(1,6))
print(c_list)
c_list.insert(3,'CRAZY')
c_list.insert(3,tuple('crazy'))
print(c_list)

del c_list[3:4]
print(c_list)

c_list = [20,'crazyit',30,-4,'crazyit',3.4]
c_list.remove(30)
print(c_list)

scores = {'语文': 89,'数学': 92,'英语': 93}
print(scores)
em={}
print(em)

vegetables = [('celery',1.58),('brocoli',1.29),('lettuce',2.19)]
dict = dict(vegetables)
print(dict)

print(scores['语文'])
scores[97] = 98
print(scores)
del scores[97]
print(scores)

print(scores.items())
scores.pop('数学')
print(scores)
scores.setdefault('数学',92)
print(scores)
scores.setdefault('数学', 100)
print(scores)